package com.luyang.framework.validator.annotation;

import com.luyang.framework.validator.PhoneNumValidator;

import javax.validation.Constraint;
import javax.validation.Payload;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author lu_yang
 */
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = PhoneNumValidator.class)
@Target({ElementType.FIELD, ElementType.PARAMETER})
public @interface CheckPhoneNum {

    String message() default "手机号码格式有误";

    Class[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    /**
     * 是否必填 不能为空
     */
    boolean required() default true;


    @Documented
    @Retention(RetentionPolicy.RUNTIME)
    @Target({ElementType.FIELD, ElementType.PARAMETER})
    public @interface List {
        CheckPhoneNum[] value();
    }
}
